#! /usr/bin/python
# _*_ coding: utf-8 _*_

'a mod with all enums'

__author__ = 'alanpo'

from enum import Enum, unique


#块类型枚举
@unique
class IsWhat(Enum):
    Framel = '-|'
    Framer = '|-'
    Framexy = '=='
    Block = '  '
    Head = '头'
    Body = '身'
    Tail = '尾'
    Food = '硫'

    #打印块图像的方法
    def print_it(self):
        for it in IsWhat:
            if self == it:
                print(self.value, end='')


#移动方向枚举
@unique
class Direction(Enum):
    Left = 1
    Right = 3
    Up = 2
    Down = 4
    Stop = 5

    def get_direction(self):
        return self.value


#下步行动枚举
@unique
class Todo(Enum):
    Move = 0
    Grow = 1
    Die = 2


def to_direction(x: int):
    if x == 1: return Direction.Left
    elif x == 2: return Direction.Up
    elif x == 3: return Direction.Right
    elif x == 4: return Direction.Down
    elif x == 5: return Direction.Stop


#test
if __name__ == "__main__":
    for iswhat in IsWhat:
        iswhat.print_it()
    print()
    for dirs in Direction:
        print(dirs)